﻿@*
//------------------------------------------------------------------------------
//  此代码版权声明为全文件覆盖，如有原作者特别声明，会在下方手动补充
//  此代码版权（除特别声明外的代码）归作者本人Diego所有
//  源代码使用协议遵循本仓库的开源协议及附加协议
//  Gitee源代码仓库：https://gitee.com/diego2098/ThingsGateway
//  Github源代码仓库：https://github.com/kimdiego2098/ThingsGateway
//  使用文档：https://diego2098.gitee.io/thingsgateway-docs/
//  QQ群：605534569
//------------------------------------------------------------------------------
*@

@page "/MqttClient"

@namespace ThingsGateway.Foundation.Demo
@using BlazorComponent;
@using Microsoft.AspNetCore.Components.Web;
@using Masa.Blazor.Presets;
@using Microsoft.JSInterop;


@using ThingsGateway.Foundation.Core;
@using ThingsGateway.Foundation.Extension;
@using Masa.Blazor



<MqttClientPage @ref=mqttClientPage></MqttClientPage>


<DriverDebugUIPage @ref=driverDebugUIPage Sections="_sections" ShowDefaultOtherContent=false>
    <ReadWriteContent>
        <div class="my-1 py-1">

            <MTextarea Class="mx-1 my-1" Label="订阅主题" Dense Outlined HideDetails="@("auto")" @bind-Value=@driverDebugUIPage.Address />

             <MButton Class="mx-1 my-1" Color="primary" OnClick="SubscribeAsync">
                添加
            </MButton>
             <MButton Class="mx-1 my-1" Color="primary" OnClick="UnsubscribeAsync">
                移除
            </MButton>

             <MTextarea Class="mx-1 my-1" Label="发布主题" Dense Outlined HideDetails="@("auto")" @bind-Value=@PublishTopic />
             <MTextarea Class="mx-1 my-1" Label="发布内容" Dense Outlined HideDetails="@("auto")" @bind-Value=@PublishValue />

             <MButton Class="mx-1 my-1" Color="primary" OnClick="PublishAsync">
                 发布
             </MButton>


             <MSubheader Class="mt-4 font-weight-black"> Rpc  </MSubheader>

             <MTextarea Class="mx-1 mt-3 my-1" Label="Rpc主题" Dense Outlined HideDetails="@("auto")" @bind-Value=@MqttRpcTopicPair.RequestTopic />
             <MTextarea Class="mx-1 mt-3 my-1" Label="Rpc返回主题" Dense Outlined HideDetails="@("auto")" @bind-Value=@MqttRpcTopicPair.ResponseTopic />
             <MTextarea Class="mx-1 mt-3 my-1" Label="Rpc内容" Dense Outlined HideDetails="@("auto")" @bind-Value=@driverDebugUIPage.WriteValue />
             <MButton Class="mx-1 my-1" Color="primary" OnClick="RpcExecuteAsync">
                执行
            </MButton>


        </div>



        <MCol Class="my-1 py-1">
            <MRow NoGutters>



            </MRow>

        </MCol>

    </ReadWriteContent>
</DriverDebugUIPage>





@code {
    private readonly List<(string Code, string Language)> _sections = new();

}